#include "thread.hpp"

void* routine(void* argv)
{
    int cnt = 10;

    while(cnt--)
    {
        std::cout << "新线程名:" << (char*)argv << std::endl;
        std::cout << "线程Id:" << pthread_self() << std::endl;
        sleep(1);
    }

    return nullptr;
}

int main()
{
    Task t(routine);

    Thread tr(t,(void*)"新线程");

    tr.Start();

    int cnt = 10;

    while(cnt--)
    {
        std::cout << "main 线程" << std::endl;
        std::cout << "main线程Id:" << pthread_self() << std::endl;
        sleep(1);
    }

    tr.Cancel();

    return 0;
}